import { ColorInfo } from "../../../resource/info/ColorInfo";
import { ColorConfig } from "../../../resource/ColorConfig";
import { EPrictUnit } from "../../../../../Message/Public/EPrictUnit";
import { Language } from "../../../../../extend/language/Language";
type int = number;
//class MoneyUtil
    
    export  class MoneyUtil
    {
        

        public static getFormatInt(arg1: int): string
        {
            var loc3=null;
            var loc1=arg1.toString();
            var loc2="";
            while (loc1.length > 3) 
            {
                loc3 = loc1.slice(loc1.length - 3);
                loc1 = loc1.slice(0, loc1.length - 3);
                loc2 = "," + loc3 + loc2;
            }
            if (loc1.length > 0) 
            {
                loc2 = loc1 + loc2;
            }
            return loc2;
        }

        public static getCoinColor(arg1: int): ColorInfo
        {
            var loc1=new ColorInfo();
            if (arg1 < 1000) 
            {
                loc1 = ColorConfig.instance.getCoinColor(1);
            }
            else if (arg1 < 10000) 
            {
                loc1 = ColorConfig.instance.getCoinColor(2);
            }
            else if (arg1 < 1000000) 
            {
                loc1 = ColorConfig.instance.getCoinColor(3);
            }
            else 
            {
                loc1 = ColorConfig.instance.getCoinColor(4);
            }
            return loc1;
        }

        public static getGoldColor(arg1: int): ColorInfo
        {
            var loc1=new ColorInfo();
            if (arg1 < 100) 
            {
                loc1 = ColorConfig.instance.getGoldColor(1);
            }
            else if (arg1 < 1000) 
            {
                loc1 = ColorConfig.instance.getGoldColor(2);
            }
            else if (arg1 < 10000) 
            {
                loc1 = ColorConfig.instance.getGoldColor(3);
            }
            else 
            {
                loc1 = ColorConfig.instance.getGoldColor(4);
            }
            return loc1;
        }

        public static getGoldHtml(arg1: int): string
        {
            return "<font face=\'宋体\' color=\'" + MoneyUtil.getGoldColor(arg1).color + "\'>" + MoneyUtil.getFormatInt(arg1) + "</font>";
        }

        public static getCoinHtml(arg1: int): string
        {
            return "<font face=\'宋体\' color=\'" + MoneyUtil.getCoinColor(arg1).color + "\'>" + MoneyUtil.getFormatInt(arg1) + "</font>";
        }

        public static getMoneyName(arg1: int): string
        {
            var loc1="";
            var loc2=arg1;
            switch (loc2) 
            {
                case EPrictUnit._EPriceUnitCoin:
                {
                    loc1 = Language.getString(69906);
                    break;
                }
                case EPrictUnit._EPriceUnitGold:
                {
                    loc1 = Language.getString(69905);
                    break;
                }
                case EPrictUnit._EPriceUnitCoinBind:
                {
                    loc1 = Language.getString(69908);
                    break;
                }
                case EPrictUnit._EPriceUnitGoldBind:
                {
                    loc1 = Language.getString(69907);
                    break;
                }
            }
            return loc1;
        }
    }
